#!/bin/bash
# Script to instantiate chaincode
cp $FABRIC_CFG_PATH/core.yaml /vars/core.yaml
cd /vars
export FABRIC_CFG_PATH=/vars

{% include "envsetting.j2" %}

configtxgen -profile OrgChannel -outputAnchorPeersUpdate \
  ./${CORE_PEER_LOCALMSPID}_Anchor.tx -channelID {{ CHANNEL_NAME }} -asOrg ${CORE_PEER_LOCALMSPID}

peer channel update -o $ORDERER_ADDRESS --tls --cafile $ORDERER_TLS_CA \
  -f ${CORE_PEER_LOCALMSPID}_Anchor.tx -c {{ CHANNEL_NAME }}
